#ifndef CDACCONTROLER_H
#define CDACCONTROLER_H
#include <QObject>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QDateTime>
#include <QList>
#include <QDebug>
#include <QString>
#include <QChar>
#include <math.h>
#include "myHelper/myhelper.h"
typedef enum eChannel
{
    C1=1,
    C2=2,
    ALL=0
}ECHANNEL;
class CDacControler : public QSerialPort
{
    Q_OBJECT
public:
    explicit CDacControler(QObject *parent = 0);
    explicit CDacControler(const QSerialPortInfo &serialPortInfo, QObject *parent = nullptr);
    explicit CDacControler(const QString &strPortName, QSerialPort::BaudRate baud,QObject *parent = 0);
    ~CDacControler();
    //对外接口
    bool set1RoadDacOutput(float volt1); //volt1:0-5V
    bool setBatterySimulatorOutput(float volt1, float radio=205); //电池模拟器输出 倍率放大radio  volt1:0-1000V
private: //两路
    bool set2RoadDacOutput(ECHANNEL channel,float volt1, float volt2); //DAC实际输出 0.000V-9.999V
    bool setBatterySimulatorOutput(ECHANNEL channel,float volt1, float volt2,float radio=205); //电池模拟器输出 倍率放大radio
signals:

public slots:
private:


    void paraInit(); //初始化参数函数
    void dealRec(); //接受处理函数
};

#endif // CDACCONTROLER_H


/*
 *
 *
【串口DAC/正负10V输出/数字转模拟/DAC8562/单片机开发板】https://m.tb.cn/h.3wW8Bo6 点击链接，再选择浏览器咑閞；或復·制这段描述￥yDxcbFMOrlB￥后到淘寳
单路：-10V-=10V

5a 01 34 56 A5=5a 01 04 56 A5
34 56=>4.56v
04 56=>4.56V

电池模拟器=DAC+高压电源

DAC：0-5V
高压电源倍率：205


*/
